﻿using System;
using System.Collections.Generic;
using System.Text;

namespace Kenly.DBFramework.Gateway
{
    /// <summary>
    /// Represents a attribute that contains metadata to describe the association between container and property.
    /// </summary>
    [AttributeUsage(AttributeTargets.Property, AllowMultiple = false)]
    public sealed class AssociationAttribute : Attribute
    {
        private AssociationType _relationType ;

        private string _resultOrder = "";
        private string _resultFilter;

        private Type _elementType;
        private Type _interrelationType;
        private string _interrelationFilter;


        /// <summary>
        /// Represents a attribute that contains metadata to describe the association between container and property,it can be used to marke a property only.
        /// </summary>
        /// <param name="relationType"></param>
        public AssociationAttribute(AssociationType relationType)
        {
            _relationType = relationType;
        }

        /// <summary>
        /// AssociationType
        /// </summary>
        public AssociationType AssociationType
        {
            get
            {
                return _relationType;
            }
        }

        /// <summary>
        /// The element type of property.
        /// </summary>
        public Type ElementType
        {
            get
            {
                return _elementType;
            }
            set
            {
                _elementType = value;
            }
        }

        /// <summary>
        /// InterrelationType
        /// </summary>
        public Type InterrelationType
        {
            get
            {
                return _interrelationType;
            }
            set
            {
                _interrelationType = value;
            }
        }

        /// <summary>
        /// InterrelationFilter
        /// </summary>
        public string InterrelationFilter
        {
            get
            {
                return _interrelationFilter;
            }
            set
            {
                _interrelationFilter = value;
            }
        }

        /// <summary>
        /// ResultFilter
        /// </summary>
        public string ResultFilter
        {
            get
            {
                return _resultFilter;
            }
            set
            {
                _resultFilter = value;
            }
        }

        /// <summary>
        /// ResultOrder
        /// </summary>
        public string ResultOrder
        {
            get
            {
                return _resultOrder;
            }
            set
            {
                _resultOrder = value;
            }
        }


    }
}
